Skip to content

feat(template-builder): wire lockMode through field insertion paths#2721

Merged
caio-pizzol merged 7 commits intomainfrom
caio/sd-1866-add-structuredcontent-lock-support-to-template-builder
Apr 6, 2026
Merged

feat(template-builder): wire lockMode through field insertion paths#2721
caio-pizzol merged 7 commits intomainfrom
caio/sd-1866-add-structuredcontent-lock-support-to-template-builder

Conversation

@caio-pizzol
Copy link
Copy Markdown
Contributor

SuperDoc core already enforces SDT lock modes, but Template Builder never passed lockMode to the editor commands. This adds:

  • LockMode type and lockMode prop on FieldDefinition / TemplateField
  • defaultLockMode prop on SuperDocTemplateBuilderProps
  • lockMode threading through insertFieldInternal, handleSelectExisting, and handleMenuSelect
  • lockMode read-back in getTemplateFieldsFromEditor

Closes SD-1866

SuperDoc core already enforces SDT lock modes (SD-1616), but Template
Builder never passed lockMode to the editor commands. This adds:

- LockMode type and lockMode prop on FieldDefinition / TemplateField
- defaultLockMode prop on SuperDocTemplateBuilderProps
- lockMode threading through insertFieldInternal, handleSelectExisting,
  and handleMenuSelect
- lockMode read-back in getTemplateFieldsFromEditor

Closes SD-1866
@linear
Copy link
Copy Markdown

linear bot commented Apr 6, 2026

@caio-pizzol caio-pizzol self-assigned this Apr 6, 2026
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9d925e9d23

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

areTemplateFieldsEqual omitted lockMode, so lock-only changes were
silently dropped by discoverFields. Also tightens the lockMode spread
guard from truthiness to nullish check for consistency with the ??
resolution above.
Documents field locking in configuration guide and API reference.
Adds a dropdown to the default FieldMenu create form so users can
set a lock mode when creating new fields. Options: No lock, Unlocked,
Container locked, Content locked, Fully locked.
- deleteField no longer force-removes locked fields from state when
  the editor command is rejected by the lock plugin
- FieldList sidebar shows a lock icon for fields with active lock modes
- Revert lock guard in deleteField — template authors can always
  delete fields regardless of lock mode
- Replace 5-option lock dropdown with a simple "Locked" checkbox
  that maps to contentLocked
- Full LockMode type still available for programmatic use
Focus on contentLocked as the default, remove the 4-mode table,
clarify that locking only affects end users not template authors.
@caio-pizzol caio-pizzol added this pull request to the merge queue Apr 6, 2026
Merged via the queue into main with commit fbc16e8 Apr 6, 2026
5 checks passed
@caio-pizzol caio-pizzol deleted the caio/sd-1866-add-structuredcontent-lock-support-to-template-builder branch April 6, 2026 16:11
@superdoc-bot
Copy link
Copy Markdown
Contributor

superdoc-bot bot commented Apr 6, 2026

🎉 This PR is included in template-builder v1.3.0-next.25

The release is available on GitHub release

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant